package threadPool;

import threadPool.threadExecutePool.Thread1;
import threadPool.threadExecutePool.Thread2;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

/**
 * Description
 *
 * @ClassName threadPool
 * @Copyright 炫彩互动
 * @Author yanglh
 * @Create Date  2016/6/1
 * @Modified by none
 * @Modified Date
 */

public class BlockingQueueTest {
    private static int i;

    public static int getI() {
        return i;
    }

    public synchronized static int addI() {
        i=i+1;
        return i;
    }

    public static void main(String[] args) {
        BlockingQueue<Integer> blockingQueue = new LinkedBlockingQueue<Integer>();
        Thread1 t10 = new Thread1(blockingQueue);
        Thread1 t11 = new Thread1(blockingQueue);
        Thread1 t12 = new Thread1(blockingQueue);
        Thread1 t13 = new Thread1(blockingQueue);
        Thread1 t14 = new Thread1(blockingQueue);
        Thread1 t15 = new Thread1(blockingQueue);
        Thread1 t16 = new Thread1(blockingQueue);
        Thread1 t17 = new Thread1(blockingQueue);
        Thread2 t2 = new Thread2(blockingQueue);
        t10.start();
        t11.start();
        t12.start();
        t13.start();
        t14.start();
        t15.start();
        t16.start();
        t17.start();
        t2.start();
    }
}
